package it.infodea.tapestrydea.services.breadcrumb;

import it.infodea.tapestrydea.services.breadcrumb.bean.BreadcrumbBean;

import java.util.Iterator;

import org.apache.tapestry5.ComponentResources;

public interface BreadcrumbService {

	/**
	 * Add a bread crumb to the service
	 * 
	 * @param resources
	 *            See {@link ComponentResources}
	 * @param breadcrumbCategoryId
	 *            The id of category where add the bread crumb. If null,
	 *            a category id is generated from the URL of page that
	 *            containing this component.
	 * @param label
	 *            The bread crumb label. If null, a reasonable label is
	 *            generated from the page name of component's container, looking
	 *            for a message key named "path_pagename-breadcrumb-label"
	 *            (substituting the path_pagename with current page name where
	 *            the path separator '/' is replace by '_').
	 */
	void addBreadcrumb(ComponentResources resources, String breadcrumbCategoryId, String label);

	/**
	 * Add a bread crumb to the service
	 * 
	 * @param resources
	 *            See {@link ComponentResources}
	 * @param label
	 *            The bread crumb label
	 */
	void addBreadcrumb(ComponentResources resources, String label);

	/**
	 * Add a bread crumb to the service
	 * 
	 * @param resources
	 *            See {@link ComponentResources}
	 */
	void addBreadcrumb(ComponentResources resources);

	/**
	 * Remove all bread crumbs.
	 */
	void reset();

	/**
	 * Get an iterator of bread crumbs
	 * 
	 * @return
	 */
	Iterator<BreadcrumbBean> iterator();

	/**
	 * Remove last bread crumb.
	 */
	void removeLast();

}
